perm filename DTLNET.MID[D,MRC] blob
sn#454599 filedate 1979-06-25 generic text, type C, neo UTF8
COMMENT ⊗ VALID 00006 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 TITLE DTLNET
C00004 00003 CORBEG RPCBLK PID WINDOW PHONUM DLIBUF DLOBUF COREND CRLF
C00005 00004 DTLNET GETHST
C00006 00005 DLNOPN
C00009 00006 LOOP TTILUP TTIDUN DLILP0 DLILUP BPDONE DLIDUN FLUSH CLOSED
C00012 ENDMK
C⊗;
TITLE DTLNET
SUBTTL Definitions
; Mark Crispin, SU-AI, June '79
; Dialnet user TELNET
; Assembly switches
IFNDEF DLIBSZ,DLIBSZ==256. ; # of bytes in DLN input buffer
IFNDEF DLOBSZ,DLOBSZ==40. ; # of bytes in DLN output buffer
; AC definitions
A=1 ? B=2 ? C=3 ? D=4
; System bit definitions
INTTTY==020000,, ; TTY input
INTCLK==000200,, ; clock interrupts
INTIMS==000020,, ; DLN status change
INTINP==000010,, ; DLN input
IO%CLS==000200 ; connection closing
IO%EOF==000400 ; end of file
BSACT== 000020 ; activate on BS
SPCBRK==000100,, ; special activation mode
;CORBEG RPCBLK PID WINDOW PHONUM DLIBUF DLOBUF COREND CRLF
SUBTTL Data area
CORBEG==. ; first loc zeroed at init time
RPCBLK: 0 ; RPC command block
PID: BLOCK 2 ; remote process-ID
WINDOW: BLOCK 1 ; window
PHONUM: BLOCK 2 ; phone number
0 ; insure phone number is ASCIZ
DLIBUF: BLOCK DLIBSZ/4 ; Dialnet input buffer
DLOBUF: BLOCK DLOBSZ/4 ; Dialnet output buffer
COREND==.-1
CRLF: ASCIZ/
/
;DTLNET GETHST
SUBTTL Start of program
DTLNET: CAI
RESET ; flush all I/O
GETHST: OUTSTR [ASCIZ/Host: /] ; stopgap super simple host-parser
INCHWL ; let first character tell it all
CLRBFI
ANDI 137 ; flush bucky bits, lower case
CAIN "G
JRST [ DMOVE A,[ASCII/4153261639/]
DMOVEM A,PHONUM
JRST DLNOPN]
CAIN "L ; LOTS?
JRST [ DMOVE A,[ASCII/4153291870/]
DMOVEM A,PHONUM
JRST DLNOPN]
CAIE "S ; SAIL?
JRST [ OUTSTR [ASCIZ/I don't know that host.
/]
JRST GETHST]
;; DMOVE A,[ASCII/4154941659]
;; DMOVEM A,PHONUM
; Falls through
;DLNOPN
; drops in
SKIPA B,[SIXBIT/DLN1/] ; use kludge port for SAIL
DLNOPN: MOVE B,[SIXBIT/DLN0/] ; else use VADIC
MOVEI A,417 ; dump mode
SETZ C, ; never any buffers!
OPEN A ; seize the port
JRST [ OUTSTR [ASCIZ/Port is busy.
/]
JRST GETHST] ; failed, probably another user has it
SETSTS 17 ; flush no-wait bit to avoid confusion with EOF
DMOVE A,[.BYTE 9 ? "T ? "E ? "L ? "N ? "E ? "T]
DMOVEM A,PID
MOVEI A,5 ; set up for maximal window size
MOVEM A,WINDOW
OUTSTR [ASCIZ/ Trying... /]
MTAPE RPCBLK ; now open up the connection
JRST [ MOVE A,RPCBLK ; get error code
CAIN A,3000 ; print appropriate error messages
JRST [ OUTSTR [ASCIZ/Port busy with another RPC
/]
JRST DTLNET]
TRZE A,1000
JRST [ OUTSTR [ASCIZ/Dialer abort failure, code /]
OUTCHR A
OUTSTR CRLF
JRST DTLNET]
TRZE A,2000
CAIE A,"B ; only supposed to encounter this one
JRST [OUTSTR [ASCIZ/Unknown RPC failure
/]
JRST DTLNET]
OUTSTR [ASCIZ/Busy or no answer
/]
JRST DTLNET]
OUTSTR [ASCIZ/dialed... /]
MTAPE [7] ; wait for connection
JRST [ OUTSTR [ASCIZ/Refused
/]
JRST DTLNET]
OUTSTR [ASCIZ/Open
/]
SETACT [[ 777777,,777777 ; activate on everything
777777,,777777 ; just set it up for when we need it
777777,,777777
777777,,600000\BSACT]]
PTJOBX [0 ? 3]
LOCK
MOVEI [DISMIS] ; set up interrupt server
MOVEM JOBAPR
CLKINT 2*60.
MOVSI (INTTTY\INTIMS\INTINP)
INTENB ; enable interrupts
; falls thorough
;LOOP TTILUP TTIDUN DLILP0 DLILUP BPDONE DLIDUN FLUSH CLOSED
SUBTTL Main program
; drops in
LOOP: IWAIT ; wait for an interrupt to happen
DMOVE C,[441100,,DLOBUF ? DLOBSZ]
TTILUP: INCHSL ; get a byte from the TTY
JRST TTIDUN ; nothing, try the port
CAIN ↑M ; if a CR,
INCHRW A ; flush the LF right after it
CAIE 600\"L ; CONTROL-META-L is character mode
CAIN 600\"l
JRST [HRROI [001000,,(SPCBRK)]
TTYSET
JRST TTILUP]
CAIE 400\"L ; META-L is character mode
CAIN 400\"l
JRST [HRROI [002000,,(SPCBRK)]
TTYSET
JRST TTILUP]
CAIE 600\"Q ; CONTROL-META-Q exits
CAIN 600\"q
JRST FLUSH
CAIE 400\"Q ; so does META-Q
CAIN 400\"q
JRST FLUSH
ANDI 377 ; turn off META bit
TRZE 200 ; CONTROL set?
ANDI 37
IDPB C
SOJG D,TTILUP
TTIDUN: DMOVE A,[441100,,DLOBUF ? DLOBSZ]
SUBI B,(D) ; minus number free in buffer
JUMPE B,DLILP0
SETZ C,
OUTPUT A
MTAPE [5]
DLILP0: DMOVE A,[441140,,DLIBUF ? DLIBSZ]
SETZ C, ; always channel 0
INPUT A
JUMPN C,[OUTSTR [ASCIZ/Server used non-zero channel
/]
JRST 4,.+1]
MOVE A,[441100,,DLIBUF]
SUBI B,DLIBSZ ; B ← - # of characters in buffer
JUMPE B,DLIDUN
DLILUP: ILDB C,A ; simple, ain't it?
CAIN C,↑G
JRST [ SETO C,
BEEP
JRST BPDONE]
OUTCHR C ; should be made smarter to reduce UUO overhead
BPDONE: AOJL B,DLILUP ; but not now
JRST DLILP0
DLIDUN: STATZ IO%EOF ; EOF raised?
STATO IO%CLS ; yes, CLS raised too?
JRST LOOP ; no, still okay
FLUSH: RELEASE ; flush connection
CLOSED: OUTSTR [ASCIZ/
Connection closed
/]
EXIT
END DTLNET